package com.mk.cloud.common.domain;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.beetl.sql.core.annotatoin.AssignID;
import org.beetl.sql.core.annotatoin.Param;
import org.beetl.sql.core.mapper.BaseMapper;

import javax.persistence.Transient;
import java.io.Serializable;
import java.math.*;
import java.util.Date;
import java.sql.Timestamp;
import java.util.List;

/*
* 
* gen by beetlsql 2018-04-04
*/
public class PUser   implements Serializable{
	//用户标识(生成策略，数字字母组合的8位编码)
	@AssignID
	private String fuserid ;
	//地址
	private String address ;
	//区域代码
	private String areacode ;
	//区域名称
	private String areaname ;
	//审核备注
	private String auditremark ;
	//审核时间
	private String audittime ;
	//审核人
	private String audituserid ;
	//市代码
	private String citycode ;
	//市名称
	private String cityname ;
	//创建时间
	private String createtime ;
	//所属一级推广
	private String fuserid1 ;
	//所属二级推广
	private String fuserid2 ;
	//昵称
	private String nickname ;
	//微信小程序标识
	private String openid ;
	//用户标识---真实推广人,形成消费的推广人
	private String pfuserid ;
	//pfuserid2 首次推广人---不一定形成消费(在没有推广人时形成消费--则成为推广人推广人)
	private String pfuserid2 ;

//	@Transient
	//用于存放临时分享人(不是第一个分享人同时被分享的用户还未产生消费)
//	private String pfuserid3;
	//手机号
	private String phone ;
	//金额(方案金额)
	private BigDecimal planamount ;
	//推广人级别（1：第一级合伙人，2第二级推广人，3第三级推广人，4三级以上推广人）
	private String plevel ;
	//省代码
	private String provincecode ;
	//省名称
	private String provincename ;
	//方案关联编码
	private String pscode ;
	//真实姓名
	private String realname ;
	//店铺名称
	private String shopname ;
	//审核状态（1待审核，2审核驳回，3审核通过）
	private String pustatus ;
	//品牌区域分组
	private String taid ;
	//累计金额
	private BigDecimal totamount ;
	//锁定金额,提现申请中的金额
	private BigDecimal lockamount ;

	//用户头像
	private String userface ;
	//用户名
	private String username ;
	//可用余额
	private BigDecimal walletamount ;

	private String coid;
	//用户状态0覆盖,1正常
	private String pustate;

	private String alipay;
	private String alipaytype;
	private String alipaypwd;

	private String pked;

	@Transient
	private String taarea;
	//推店数量
	@Transient
	private Integer counts;

	public String getPked() {
		return pked;
	}

	public void setPked(String pked) {
		this.pked = pked;
	}

	public String getCoid() {
		return coid;
	}

	public void setCoid(String coid) {
		this.coid = coid;
	}
	
	public PUser() {
	}

	public Integer getCounts() {
		return counts;
	}

	public void setCounts(Integer counts) {
		this.counts = counts;
	}

	public BigDecimal getLockamount() {
		return lockamount;
	}

	public void setLockamount(BigDecimal lockamount) {
		this.lockamount = lockamount;
	}

	public String getPfuserid2() {
		return pfuserid2;
	}

	public void setPfuserid2(String pfuserid2) {
		this.pfuserid2 = pfuserid2;
	}

	public String getAlipay() {
		return alipay;
	}

	public void setAlipay(String alipay) {
		this.alipay = alipay;
	}

	public String getAlipaytype() {
		return alipaytype;
	}

	public void setAlipaytype(String alipaytype) {
		this.alipaytype = alipaytype;
	}

	public String getAlipaypwd() {
		return alipaypwd;
	}

	public void setAlipaypwd(String alipaypwd) {
		this.alipaypwd = alipaypwd;
	}

	public String getPustate() {
		return pustate;
	}

	public void setPustate(String pustate) {
		this.pustate = pustate;
	}

	public String getFuserid(){
		return  fuserid;
	}
	public void setFuserid(String fuserid ){
		this.fuserid = fuserid;
	}
	
	public String getAddress(){
		return  address;
	}
	public void setAddress(String address ){
		this.address = address;
	}
	
	public String getAreacode(){
		return  areacode;
	}
	public void setAreacode(String areacode ){
		this.areacode = areacode;
	}
	
	public String getAreaname(){
		return  areaname;
	}
	public void setAreaname(String areaname ){
		this.areaname = areaname;
	}
	
	public String getAuditremark(){
		return  auditremark;
	}
	public void setAuditremark(String auditremark ){
		this.auditremark = auditremark;
	}
	
	public String getAudittime(){
		return  audittime;
	}
	public void setAudittime(String audittime ){
		this.audittime = audittime;
	}
	
	public String getAudituserid(){
		return  audituserid;
	}
	public void setAudituserid(String audituserid ){
		this.audituserid = audituserid;
	}
	
	public String getCitycode(){
		return  citycode;
	}
	public void setCitycode(String citycode ){
		this.citycode = citycode;
	}
	
	public String getCityname(){
		return  cityname;
	}
	public void setCityname(String cityname ){
		this.cityname = cityname;
	}
	
	public String getCreatetime(){
		return  createtime;
	}
	public void setCreatetime(String createtime ){
		this.createtime = createtime;
	}
	
	public String getFuserid1(){
		return  fuserid1;
	}
	public void setFuserid1(String fuserid1 ){
		this.fuserid1 = fuserid1;
	}
	
	public String getFuserid2(){
		return  fuserid2;
	}
	public void setFuserid2(String fuserid2 ){
		this.fuserid2 = fuserid2;
	}
	
	public String getNickname(){
		return  nickname;
	}
	public void setNickname(String nickname ){
		this.nickname = nickname;
	}
	
	public String getOpenid(){
		return  openid;
	}
	public void setOpenid(String openid ){
		this.openid = openid;
	}
	
	public String getPfuserid(){
		return  pfuserid;
	}
	public void setPfuserid(String pfuserid ){
		this.pfuserid = pfuserid;
	}
	
	public String getPhone(){
		return  phone;
	}
	public void setPhone(String phone ){
		this.phone = phone;
	}
	
	public BigDecimal getPlanamount(){
		return  planamount;
	}
	public void setPlanamount(BigDecimal planamount ){
		this.planamount = planamount;
	}
	
	public String getPlevel(){
		return  plevel;
	}
	public void setPlevel(String plevel ){
		this.plevel = plevel;
	}
	
	public String getProvincecode(){
		return  provincecode;
	}
	public void setProvincecode(String provincecode ){
		this.provincecode = provincecode;
	}
	
	public String getProvincename(){
		return  provincename;
	}
	public void setProvincename(String provincename ){
		this.provincename = provincename;
	}
	
	public String getPscode(){
		return  pscode;
	}
	public void setPscode(String pscode ){
		this.pscode = pscode;
	}
	
	public String getRealname(){
		return  realname;
	}
	public void setRealname(String realname ){
		this.realname = realname;
	}
	
	public String getShopname(){
		return  shopname;
	}
	public void setShopname(String shopname ){
		this.shopname = shopname;
	}

	public String getPustatus() {
		return pustatus;
	}

	public void setPustatus(String pustatus) {
		this.pustatus = pustatus;
	}

	public String getTaid(){
		return  taid;
	}
	public void setTaid(String taid ){
		this.taid = taid;
	}
	
	public BigDecimal getTotamount(){
		return  totamount;
	}
	public void setTotamount(BigDecimal totamount ){
		this.totamount = totamount;
	}
	
	public String getUserface(){
		return  userface;
	}
	public void setUserface(String userface ){
		this.userface = userface;
	}
	
	public String getUsername(){
		return  username;
	}
	public void setUsername(String username ){
		this.username = username;
	}
	
	public BigDecimal getWalletamount(){
		return  walletamount;
	}
	public void setWalletamount(BigDecimal walletamount ){
		this.walletamount = walletamount;
	}

	public String getTaarea() {
		return taarea;
	}

	public void setTaarea(String taarea) {
		this.taarea = taarea;
	}

	public interface Mapper extends BaseMapper<PUser> {

		/**
		 * 更新钱余额,并且返回更新后的结果
		 * @param fuserid
		 * @param amount
		 * @return
		 */
		void addWalletByFuserid(@Param("fuserid")String fuserid, @Param("amount")BigDecimal amount);

		/**
		 * 更新钱余额,不更新累计金额
		 * @param fuserid
		 * @param amount
		 */
		void subtractWalletByFuserid(@Param("fuserid")String fuserid, @Param("amount")BigDecimal amount);

		/**
		 * 锁定金额
		 * @param fuserid
		 * @param amount
		 */
		void lockAmountByFuserid(@Param("fuserid")String fuserid, @Param("amount")BigDecimal amount);

		PUser selectPUserByid(@Param("fuserid")String fuserid);

		List<JSONObject> countRatioUser(@Param("ratio")String ratio,@Param("coid")String coid, @Param("begintime")String begintime,@Param("endtime")String endtime);

		/**
		 * 将该时间段内的用户置为已PK过
		 * @param begintime
		 * @param endtime
		 * @return
		 */
		Integer updatePkedToOne(@Param("begintime")String begintime,@Param("endtime")String endtime);

		/**
		 * 查询所有用户主键
		 * @return
		 */
		List<String> selectAllFuserids();
	}
	

}
